package me.qixiaobo.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;


@ApiModel(value = "UserVO1", description = "")
@Data
@JsonIgnoreProperties(value = {"userName"})
public class UserVO1 implements Serializable {

    //序列化时候定义的输出格式
    // Long类型精度丢失的问题,可使用此方式修复
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;


    @ApiModelProperty(value = "用户名", name = "userName", dataType = "String", example = "张三", required = true)
    private String userName;

    //忽略此字段的序列化
    @JsonIgnore
    private String password;


    //对属性名称重命名
    @JsonProperty("Email")
    @ApiModelProperty(value = "邮箱", name = "mail", dataType = "String", example = "7979879@qq.com", required = false)
    private String mail;

    @ApiModelProperty(value = "手机号", name = "phone", dataType = "String", example = "185**********", required = false)
    private String phone;


    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    //返回时间戳
    @JsonFormat(shape = JsonFormat.Shape.NUMBER)
    private Date updateTime;


}
